function [tei]=cadtei3(tei);
%*** ***************************************************************
%*** * Calculates transformation matrix TIE from time and WEII3
%*** *
%*** * Argument Output:
%*** *          TEI(3,3) =Transf. of inertial wrt earth coor
%*** *
%*** * MODIFICATION HISTORY
%*** * 960711 Created by Peter Zipfel
%*** *
%*** ***************************************************************

  tei_orig=tei;
  tei_shape=[3,3];
  tei=reshape([tei_orig(1:min(prod(tei_shape),numel(tei_orig))),zeros(1,max(0,prod(tei_shape)-numel(tei_orig)))],tei_shape);


  %*** INPUT FROM EXECUTIVE

  % equivalence(bcom_1(0058),weii3) ::;
  % equivalence(bcom_1(2000),t) ::;
  t = C(CON.T);

  xi=weii3.*t;
  sxi=sin(xi);
  cxi=cos(xi);
  [tei]=matuni(tei,3);
  tei(1,1)=cxi;
  tei(1,2)=sxi;
  tei(2,1)=-sxi;
  tei(2,2)=cxi;

  
  tei_orig(1:min(prod(tei_shape),numel(tei_orig)))=tei(1:min(prod(tei_shape),numel(tei_orig)));
  
  tei=tei_orig;
  
  return;

end %subroutine cadtei3